const { executeQuery } = require('./mongo_util')

//用变量接受用户表名
const collectionName = "admin";


//登录验证
function login(user, onRetGot, onErrGot) {
    console.log(user);
    
    executeQuery(collectionName, (collection, callback) => {
        collection.findOne(user).then((res) => {
            onRetGot(res);
            callback()
        })
            .catch((err) => {
                onRetGot(err);
                callback();
        })
    })
}




module.exports = {
    login,
    
}